import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 查询出入库记录台账列表
 * @param query
 * @returns {*}
 */

export const listStockLog = (query?: StockLogVO): AxiosPromise<StockLogVO[]> => {
  return request({
    url: '/wms/stockLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询出入库记录台账详细
 * @param id
 */
export const getStockLog = (id: number): AxiosPromise<StockLogVO> => {
  return request({
    url: '/wms/stockLog/' + id,
    method: 'get'
  });
};

/**
 * 新增出入库记录台账
 * @param data
 */
export const addStockLog = (data: StockLogVO) => {
  return request({
    url: '/wms/stockLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改出入库记录台账
 * @param data
 */
export const updateStockLog = (data: StockLogVO) => {
  return request({
    url: '/wms/stockLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除出入库记录台账
 * @param id
 */
export const delStockLog = (id: number | Array<number>) => {
  return request({
    url: '/wms/stockLog/' + id,
    method: 'delete'
  });
};

export interface StockLogVO extends BaseEntity, PageQuery {
    /** 事务ID */
      id?: string | number;

    /** 物品id */
      productId?: string | number;

    /** 单位 */
      measureUnit?: string;

    /** 批次号 */
      batchCode?: string;

    /** 单据号 */
      orderId?: string | number;

    /** 单价 */
      price?: number;

    /** 仓库ID */
      warehouseId?: number;

    /** 库位ID */
      areaId?: string | number;

    /** 操作前 */
      quantityBefore?: number;

    /** 操作数量 */
      quantity?: number;

    /** 备注 */
      remark?: string;

    /** 其他表字段 */
    productName?: string;
    warehouseName?: string;

}
